import instance from '@/request/request'

/**
 * 获取系统菜单信息
 * @returns {*}
 * @constructor
 */
export const GetSystemMenuApi = () => {
  return instance({
    url: '/api/menu/getSystemMenu',
    method: 'get'
  })
}
/**
 * 分页查询角色列表
 * @param params 包括 page(当前页) pageSize(每页条数)
 * @returns {*}
 * @constructor
 */
export const GetMenuPageApi = (params) => {
  return instance({
    url: '/api/menu/page',
    method: 'get',
    params:params
  })
}
/**
 * 获取父级菜单
 * @returns {*}
 * @constructor
 */
export const GetParentMenuApi = () => {
  return instance({
    url: '/api/menu/parent',
    method: 'get',
  })
}
/**
 * 根据id获取菜单
 * @returns {*}
 * @constructor
 */
export const GetMenuByIdApi = (id) => {
  return instance({
    url: `/api/menu/${id}`,
    method: 'get',
  })
}
/**
 * 添加菜单信息
 * @returns {*}
 * @constructor
 */
export const AddMenuApi = (data) => {
  return instance({
    url: `/api/menu/addMenu`,
    method: 'post',
    data
  })
}
/**
 * 删除菜单
 * @param ids 待删除菜单的id
 * @returns {Promise<AxiosResponse<any>> | *}
 * @constructor
 */
export  const  DeleteMenusApi=(ids)=>{
  return instance({
    url: `/api/menu/deleteMenu`,
    method:'delete',
    params:{ids}
  })
}
/**
 * 修改菜单
 * @returns {*}
 * @constructor
 * @param data
 */
export  const UpdateMenuApi=(data)=>{
  return instance({
    url:'/api/menu/updateMenu',
    method:'put',
    data
  })
}
